<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="/scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/scripts/jquery-ui-1.8.24.js" type="text/javascript"></script>
    <link rel="stylesheet" media="screen" href="/content/mylogin/css/login.css">
    <title>BSF采集系统 - 观天台 - by 车江毅</title>
</head>
<body style="margin: 0">
<div class="apTitle">BSF采集系统-观天台</div>
<div class="logcon">
    <input class="login-name" type="text" placeholder="请输入用户名">
    <input class="login-password" type="password" placeholder="请输入密码">
    <button class="login-button" type="button">登录</button>
</div>
<canvas id="canvas"  width="671" height="905"></canvas>
</body>
<#--<!-- scripts &ndash;&gt;-->
<#--<script src="/content/mylogin/js/login.js"></script>-->
<#--<script src="/content/mylogin/js/loginApp.js"></script>-->
<script>
    $(function () {
        // 登录
        $(".login-button").click(function () {
            var name = $(".login-name").val();
            var password = $(".login-password").val();
            $.ajax({
                url: '/login/',
                type: "post",
                data: {
                    username: name,
                    password: password,
                },
                success: function (data) {
                    if (data.code === 200) {
                        addCookie("current",data.data,100000);
                        window.location.href = "/project/index/";
                    } else {
                        alert(data.message)
                    }
                }
            });
        });
    });
    function addCookie(name, value, expiresHours) {
        var cookieString = name + "=" + value;
        //判断是否设置过期时间
        if (expiresHours > 0) {
            var date = new Date();
            date.setTime(date.getTime + expiresHours * 3600 * 1000);
            cookieString = cookieString + "; expires=" + date.toGMTString();
        }
        document.cookie = cookieString;
    }
</script>
<script src="/content/mylogin/starback.js"></script>
<script>
    const starback =new Starback(canvas,
        {width:canvas.parentElement.clientWidth,
            height:canvas.parentElement.clientHeight,speed:5,frequency:5,slope:{x:5,y:3 },
            directionX:1,spread:.2,randomOpacity:true,backgroundColor:["#0F2027","#203A43","#2C5364"]
    });
    starback.generateStar(30);
    $(window).resize(function(){
        canvas.width=document.body.clientWidth;
        canvas.height=document.body.clientHeight;
    })
</script>
</html>
